Skip to content

feat(editor): implement multi-pane split layout#2416

Open
bajrangCoder wants to merge 23 commits into
mainfrom
feat/multi-pane-view
Open

feat(editor): implement multi-pane split layout#2416
bajrangCoder wants to merge 23 commits into
mainfrom
feat/multi-pane-view

Conversation

@bajrangCoder

@bajrangCoder bajrangCoder commented Jun 28, 2026

Copy link
Copy Markdown
Member

This PR introduces support for a Multi-Pane (Split-Screen) Editor Layout, allowing users to open multiple editor panes and view files/tabs side-by-side (similar to desktop code editors). Each pane acts as a self-contained editor workspace with its own tab bar, and tabs things. And it is not limited to editor tabs, it can work with any editor tabs such as terminal, custom, editor, media etc.

It adds few commands for this multi pane, which you can search in command palette with pane keyword.
And some keybinds:

  • Ctrl-\ : Split editor pane right
  • Ctrl-Shift-\ : Split editor pane down
  • Ctrl-Alt-W : Close active editor pane
  • Ctrl-Alt-Left : Focus editor pane to the left
  • Ctrl-Alt-Right : Focus editor pane to the right
  • Ctrl-Alt-Up : Focus editor pane above
  • Ctrl-Alt-Down : Focus editor pane below
  • Ctrl-Alt-\ : Move current tab to new pane
Screenshot 2026-06-28 at 11 03 22 PM image

@github-actions github-actions Bot added the enhancement New feature or request label Jun 28, 2026
@bajrangCoder bajrangCoder changed the title feat: add multi pane view feat(editor): implement multi-pane split layout Jun 28, 2026
@bajrangCoder bajrangCoder moved this from Backlog to In progress in The Code Board - Acode Jun 29, 2026
@bajrangCoder bajrangCoder marked this pull request as ready for review June 29, 2026 08:50
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR implements a full multi-pane split layout for the Acode editor, adding recursive pane tree management, per-pane CodeMirror instances, tab drag-and-drop across panes, and per-file autosave timers to prevent cross-pane timer collisions.

  • Core layout engine (editorManager.js): adds ~2500 lines covering pane creation/removal, a recursive paneLayoutRoot tree of pane/split nodes, withPaneEditorContext for safe context-switching, $paneAwareOpenFileList proxy for backward-compatible tab list access, and createEditorCompatibilityDescriptors to scope per-editor API closures.
  • Cross-pane tab transfers (editorFileTab.js): implements drag-session guarding via a monotonic dragSessionId counter, FLIP animations via the motion library (durations now in seconds), and contentEditable-aware text insertion on drop.
  • Auxiliary fixes: per-file docSyncTimers WeakMap replaces shared module-level timers; getDocText() WeakMap caches immutable CM6 doc serialization; null-guard fixes in fileList.js, showFileInfo.js, and main.js; Ctrl-tap multi-cursor support added to TouchSelectionMenuController.

Confidence Score: 4/5

Safe to merge with two minor P2 observations; all previously identified P1 bugs have been addressed in this PR.

All eight previously raised P1 issues (cross-pane timer races, pane-blind file-loaded handler, wrong-editor setTheme, touchSelectionController leak, openFileList contract, contentEditable drop, safety-net race, OS keybinding conflict) are correctly resolved. Two P2 observations remain: the implicit synchronous-only contract on withPaneEditorContext and the unit-less duration constant names.

src/lib/editorManager.js (withPaneEditorContext async risk) and src/handlers/editorFileTab.js (duration constant naming)

Important Files Changed

Filename Overview
src/lib/editorManager.js Core of the feature; ~2500 new lines adding pane tree, per-file timers, context-switcher, proxy list, and per-editor descriptor factory. All previous P1s resolved; one P2 (unguarded async in withPaneEditorContext) remains.
src/handlers/editorFileTab.js Cross-pane drag-and-drop with dragSessionId guard and motion-library FLIP animations; duration constants changed from ms to seconds but names not updated (P2).
src/lib/editorFile.js makeActive() and remove() correctly scope to pane via blurredFileIds Set and editorManager.removeFileFromPane; setReadOnly dispatches to correct pane editor.
src/cm/editorUtils.ts Adds getDocText() with WeakMap cache on immutable CM6 Text objects; correct and efficient.
src/cm/touchSelectionMenu.js Ctrl-tap multi-cursor session mirroring shift-selection pattern; implementation is self-contained and correct.
src/lib/commands.js New pane commands (new-pane, split-, close-pane, focus-) added cleanly; next-file/prev-file scoped to active pane.
src/lib/keyBindings.js New pane bindings added; Ctrl-Shift-W OS conflict resolved to Ctrl-Alt-W.
src/lib/openFile.js paneId propagated through all EditorFile creation paths; existing files correctly moved to target pane.
src/styles/codemirror.scss Adds pane layout styles; editor-global-open-file-list hidden in pane-tab mode.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User Action: Open File / Split Pane] --> B{Target pane specified?}
    B -- Yes --> C[insertPaneIntoLayout]
    B -- No --> D[Use active pane]
    C --> E[createPaneShell + createPaneNode]
    E --> F[new EditorView per pane]
    F --> G[createEditorCompatibilityDescriptors]
    G --> H[Per-editor setTheme / insert / session closures]
    D --> I[openFile in pane]
    I --> J[EditorFile.makeActive]
    J --> K{pane-tab layout?}
    K -- Yes --> L[$paneAwareOpenFileList Proxy]
    K -- No --> M[Global openFileList]
    L --> N[Aggregate per-pane tab lists]
    J --> O[getDocSyncTimers per file WeakMap]
    O --> P[checkTimeout + autosaveTimeout isolated per file]
    P --> Q[No cross-pane timer collision]
    R[Tab Drag] --> S[dragSessionId guard]
    S --> T{Same pane?}
    T -- Yes --> U[Reorder via motion FLIP]
    T -- No --> V[commitPaneTransfer]
    V --> W[moveDragToParent + rebuildFileListFromPanes]
    W --> X[syncGlobalOpenFileListMirror]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User Action: Open File / Split Pane] --> B{Target pane specified?}
    B -- Yes --> C[insertPaneIntoLayout]
    B -- No --> D[Use active pane]
    C --> E[createPaneShell + createPaneNode]
    E --> F[new EditorView per pane]
    F --> G[createEditorCompatibilityDescriptors]
    G --> H[Per-editor setTheme / insert / session closures]
    D --> I[openFile in pane]
    I --> J[EditorFile.makeActive]
    J --> K{pane-tab layout?}
    K -- Yes --> L[$paneAwareOpenFileList Proxy]
    K -- No --> M[Global openFileList]
    L --> N[Aggregate per-pane tab lists]
    J --> O[getDocSyncTimers per file WeakMap]
    O --> P[checkTimeout + autosaveTimeout isolated per file]
    P --> Q[No cross-pane timer collision]
    R[Tab Drag] --> S[dragSessionId guard]
    S --> T{Same pane?}
    T -- Yes --> U[Reorder via motion FLIP]
    T -- No --> V[commitPaneTransfer]
    V --> W[moveDragToParent + rebuildFileListFromPanes]
    W --> X[syncGlobalOpenFileListMirror]
Loading

Reviews (17): Last reviewed commit: "cleanup" | Re-trigger Greptile

Comment thread src/lib/editorFile.js Outdated
Comment thread src/lib/editorManager.js
Comment thread src/lib/keyBindings.js
@UnschooledGamer UnschooledGamer added the area:editor Feedback, improvements related to the editor (code editing, editor iteration, formatting, etc) label Jun 29, 2026
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as duplicate.

@bajrangCoder

This comment was marked as outdated.

Comment thread src/lib/editorManager.js
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder marked this pull request as draft June 30, 2026 12:45
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder marked this pull request as ready for review June 30, 2026 16:48
Comment thread src/handlers/editorFileTab.js
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder

This comment was marked as outdated.

Comment thread src/handlers/editorFileTab.js Outdated
@bajrangCoder

This comment was marked as outdated.

@RohitKushvaha01 RohitKushvaha01 added the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Jul 1, 2026
@github-actions github-actions Bot removed the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Jul 1, 2026
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Preview Release for this, has been built.

Click here to view that github actions build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:editor Feedback, improvements related to the editor (code editing, editor iteration, formatting, etc) enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants